
'use strict';
const app = require('tcb-admin-node');
const tcb_config = {env: 'meatom04-01-2gue0fnr49a26808'};
app.init(tcb_config).auth();
const db = app.database();

let event_param

function getVersions(params) {
    event_param = params
    return db.collection("VersionCon").where({
        version:params.version,
        platform : event_param.platform
    }).get().then(res => {
        if(res.data && res.data.length){
            return res.data
        }else{
            return []
        }
    }).catch(error => {
        return error
    })
}
exports.main = async (event, context, callback) => {
  return await getVersions(event)
};
